<?php
require_once("../model/Cliente.php");
$objCliente = new Cliente();
$result = array();
$param = $_GET["term"];
$fetch = $objCliente->autocompleteCliente($param);
$objClienteAux = new Cliente();
while ($row = mysql_fetch_array($fetch, MYSQL_ASSOC)) {
    $objClienteAux->set('cpf', $row['cpf']);
    $row_array['saldo'] = $objClienteAux->saldoDevedor();    
    $row_array['cpf'] = $row['cpf'];
    $row_array['nome'] = $row['nome'];
    $row_array['esquadrao'] = $row['esquadrao'];
    $row_array['cartao'] = $row['cartao'];
    $row_array['telefone'] = $row['telefone'];
    $row_array['endereco'] = $row['endereco'];
    $row_array['observacao'] = $row['obs'];
    array_push( $result, $row_array );
}
    echo json_encode($result);
?>